#ifndef X2C_H
#define X2C_H

#include "common.h"

// Table?
template <AllegroVersion version>
struct x2C
{
    uint32_t t;
    uint32_t k;
    uint32_t next;
    
    // May be null
    uint32_t string_ptr;
    
    uint32_t un5;
    
    // Points to instance of `x37` or `x3C` (or null).
    uint32_t ptr1;
    
    // Points to instance of `x03` (string or constant)
    uint32_t ptr2;
    
    // Points to instance of `x26` or `x2C`
    uint32_t ptr3;
    
    // Often but not always `0x0`.
    uint32_t bitmask;
    
    uint32_t TAIL;
    operator x2C<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};

#if __cplusplus >= 202002L
template <AllegroVersion version> requires(version >= A_172)
struct x2C<version>
{
    uint32_t t;
    uint32_t k;
    uint32_t next;

    uint32_t un2;
    uint32_t un3;
    uint32_t un4;

    // May be null
    uint32_t string_ptr;

    // Points to instance of `x37` or `x3C` (or null).
    uint32_t ptr1;

    // Points to instance of `x03` (string or constant)
    uint32_t ptr2;

    // Points to instance of `x26` or `x2C`
    uint32_t ptr3;

    // Often but not always `0x0`.
    uint32_t bitmask;

    uint32_t TAIL;
    operator x2C<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};
#else
template <> struct x2C<A_172>
{
    uint32_t t;
    uint32_t k;
    uint32_t next;

    uint32_t un2;
    uint32_t un3;
    uint32_t un4;

    // May be null
    uint32_t string_ptr;

    // Points to instance of `x37` or `x3C` (or null).
    uint32_t ptr1;

    // Points to instance of `x03` (string or constant)
    uint32_t ptr2;

    // Points to instance of `x26` or `x2C`
    uint32_t ptr3;

    // Often but not always `0x0`.
    uint32_t bitmask;

    uint32_t TAIL;
    operator x2C<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};
template <> struct x2C<A_174> : x2C<A_172> {};
#endif

#endif // X2C_H
